﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/jquery-1.7.1.js"></script>
    <script type="text/javascript" src="/js/sortable.4.0.js"></script>
    <script type="text/javascript" src="/js/TableExt.js"></script>
    <script type="text/javascript" src="/js/api-parser.js"></script>
    <script type="text/javascript">        
    function TRRender(i, item, num) {
            var html = '';
            html += '<tr>';
            for (var key in item) {
                html += '<td>' + item[key] + '</td>';
            }
            return html;
        }

        function GetParams() {
            return {};
        }

        function CloseDetail() {
            $('#div_bg').hide();
            $('#div_contain').hide();
        }

        var Table1 = null;
        $(document).ready(function () {
            //            Table1 = $('#tableList').NewTable('/douban/top250', TRRender, GetParams);
            Table1 = $('#tableList').NewTable('/douban/Collection?from=1&count=10', TRRender, GetParams);

            Table1.OnJsonLoaded = function (json) {
                var thead = $('#tableList thead').empty();
                var fields = json.fields;
                var html = '';
                html += '<tr>';
                for (var key in fields) {

                    html += '<th>' + key + '</th>';
                }
                html += '</tr>';
                thead.html(html);
                Temp = json;
            };

            Table1.GetListData = function (json) {
                return json.results;
            }

            $('#form1').bind('submit', function () {
                Table1.LoadData();
                return false;
            });
        });
        var Temp = null;
        function update() {
            $.get('/douban/update?id=' + $('#txt').val());
        }
    </script>
</head>
<body>
<div class="mainbox">
    <div class="rightbox">
    <input type="text" id="txt" value=""/>
    <input type="button" id="Submit1" class="input_send1" value="update" onclick="update()">
    <input type="submit" id="btn_submit" class="input_send1" value="Submit">
    </div>
    <table id="tableList">
        <thead>
        </thead>
        <tbody>
        </tbody>
    </table>
</div>
</body>
</html>